<?php 
global $_GPC, $_W;
$GLOBALS['frames'] = $this->getMainMenu();
$operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
$status=$_GPC['status'];
load()->func('tpl');
$pageindex = max(1, intval($_GPC['page']));
$pagesize=10;
$where=' WHERE  uniacid=:uniacid  ';
$data[':uniacid']=$_W['uniacid'];
if(isset($_GPC['keywords'])){
    $where.="  and (name LIKE  concat('%', :name,'%') or description LIKE  concat('%', :name,'%'))";
    $data[':name']=$_GPC['keywords']; 
}
$sql="SELECT * FROM ".tablename('snx_prize').$where. "ORDER BY create_time DESC";
$total=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('snx_prize').$where. "ORDER BY create_time DESC",$data);
$select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
$list=pdo_fetchall($select_sql,$data);
$pager = pagination($total, $pageindex, $pagesize);
if($_GPC['op']=='delete'){
    $res=pdo_delete('snx_prize',array('id'=>$_GPC['id']));
    if($res){
        message('删除成功',$this->createWebUrl('prize',array('id'=>$_GPC['id'])),'success');
    }else{
        message('删除失败','','error');
    }
}
include $this->template('web/prize');

 ?>